/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.admin.mapper;

import org.apache.ibatis.annotations.Param;
import org.springblade.modules.admin.entity.MaintainMalfunctionHistory;
import org.springblade.modules.admin.vo.MaintainPlanStatisticsVO;
import org.springblade.modules.admin.dto.MaintainPlanCheckPageDTO;
import org.springblade.modules.admin.entity.MaintainPlanCheck;
import org.springblade.modules.admin.vo.MaintainPlanCheckVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.modules.admin.vo.MaintainPlanPageVO;
import org.springblade.modules.admin.vo.check.ProblemPlanVo;
import org.springblade.modules.admin.vo.check.ProblemResultVo;
import org.springblade.modules.admin.vo.check.ProblemSearchVo;
import org.springblade.modules.admin.vo.plan.CheckChildPlanVo;

import java.util.List;

/**
 * 质检工单表 Mapper 接口
 *
 * @author ysq
 * @since 2023-11-27
 */
public interface MaintainPlanCheckMapper extends BaseMapper<MaintainPlanCheck> {

	/**
	 * 自定义分页
	 *
	 * @param page
	 * @param maintainPlanCheck
	 * @return
	 */
	List<MaintainPlanCheckVO> selectMaintainPlanCheckPage(IPage page, MaintainPlanCheckVO maintainPlanCheck);

	/**
	 * 根据条件分页查询工单列表
	 * @param page 分页参数
	 * @param maintainPlanCheckDTO 查询条件
	 * @return 分页结果列表
	 */
    List<MaintainPlanPageVO> pageByCondition(IPage<MaintainPlanPageVO> page,@Param("maintainPlanCheckDTO") MaintainPlanCheckPageDTO maintainPlanCheckDTO);

	/**
	 * 质检工单列表抬头统计
	 * @return 统计结果
	 */
    MaintainPlanStatisticsVO statistics();

	/**
	 * 根据条件查询工单列表
	 * @param maintainPlanCheckDTO 查询条件
	 * @return 工单列表
	 */
	List<MaintainPlanPageVO> listByCondition(@Param("maintainPlanCheckDTO") MaintainPlanCheckPageDTO maintainPlanCheckDTO);


	/**
	 * 获取问题点的子工单
	 * @param planIds 工单数据
	 * @return 数据集
	 */
    List<CheckChildPlanVo> getCheckChildPlanVo(List<Long> planIds);

	/**
	 * 获取质检工单的子工单
	 * @param planId 工单id
	 * @param typeStatus 工单类型
	 * @return 数据集
	 */
    List<CheckChildPlanVo> getCheckChildPlanList(@Param("planId") Long planId,@Param("typeStatus") Integer typeStatus);



	/**
	 * 获取质检工单的问题点列表工单
	 * @param problemSearchVo 查询条件
	 * @return 数据集
	 */
	List<ProblemResultVo> getProblemResultList(IPage<ProblemResultVo> page,@Param("problemSearchVo") ProblemSearchVo problemSearchVo);


	/**
	 * 质检问题点的状态数量
	 * @return 数据集
	 */
    List<MaintainMalfunctionHistory> getProblemStatus();

	/**
	 * 获取问题点列表
	 * @param malHistoryIds 历史记录id
	 * @return 数据集
	 */
	List<ProblemPlanVo> getMalfHistory(@Param("malHistoryIds") List<String> malHistoryIds);

	/**
	 * 问题点excel下载
	 * @param problemSearchVo 查询条件
	 * @return 数据集
	 */
	List<ProblemPlanVo> downProblemList(@Param("problemSearchVo") ProblemSearchVo problemSearchVo);
}
